'use strict';

const Controller = require('egg').Controller;

class FeedbackController extends Controller {
    async index() {
        const { ctx } = this;
        ctx.body = 'hi, feedback';
        var { text } = ctx.request.body;
        var db = this.app.mongodb;
        const collection = await db.collection("feedback");
        var res = await collection.insertOne({ text });
        console.log(res);
        if (res.length) {
            ctx.body = {
                status: 200,
                msg: "添加成功"
            }
        }

    }
}

module.exports = FeedbackController;
